<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>崔涣 iframe postmessage 父页面</title>
  <script type="text/JavaScript">
    function sendIt() {
            // 通过 postMessage 向子窗口发送数据
            document.getElementById("otherPage").contentWindow
                    .postMessage(
                    document.getElementById("message").value,
                    "http://192.168.1.113:1002"
            );
        }
    </script>
</head>

<body>
  <!-- 通过 iframe 嵌入子页面 -->
  <iframe src="http://192.168.1.113:1002" id="otherPage"></iframe>
  <br />
  <br />
  <input type="text" id="message" />
  <input type="button" value="Send to child.com" onclick="sendIt()" />
</body>

</html>